package www.wackyboy.top.dao;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import www.wackyboy.top.Employee;
import www.wackyboy.top.UserLogin;

import java.util.List;

/**
 * @Author: WackyBoy
 * @Date: 2021/1/5 15:54
 */
public interface IUserDao {

    @Select("select * from employee where deptId = #{deptId}")
    List<Employee> queryInfoByDeptid(Integer deptId);

    @Select("select * from employee")
    List<Employee> queryAllInfo();

    @Update("update employee set name = #{name}, gender = #{gender},birthday = #{birthday},idCard = #{idCard},nationId = #{nationId},nativePlace = #{nativePlace},politicId = #{politicId},email = #{email},phone = #{phone},address = #{address},deptName = #{deptName},posId = #{posId},topDegree = #{topDegree},school = #{school},beginData = #{beginData}, endContract=#{endContract} where id=#{id}")
    Integer saveUserInfo(Employee employee);

    @Insert("insert into employee(name,gender,birthday,idCard,nationId,nativePlace,politicId,email,phone,address,deptName,posId,topDegree,school,beginData,endContract)values(#{name},#{gender},#{birthday},#{idCard},#{nationId},#{nativePlace},#{politicId},#{email},#{phone},#{address},#{deptName},#{posId},#{topDegree},#{school},#{beginData},#{endContract})")
    Integer addUserInfo(Employee employee);

    @Delete("delete from employee where id=#{id}")
    Integer deleteUserInfo(Integer id);

    @Select("select * from employee where name like #{name}")
    List<Employee>  searchUserInfo(String name);

    @Delete("delete from employee where id = #{id}")
    Integer deleteUserByBatch(Integer id);

    @Select("select * from employee where name=#{username} and password=#{password}")
    Employee checkUserInfo(UserLogin user);
}
